package com.app.service.Information.impl;

import com.app.mapper.Information.MajorMapper;
import com.app.pojo.Major;
import com.app.service.Information.MajorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class MajorServiceImpl implements MajorService {

    @Autowired
    MajorMapper majorMapper;

    @Override
    public List<Major> getMajorsByCollege(String college) {
        return majorMapper.getMajorsByCollege(college);
    }

    @Override
    public Major getMajorByCollege(String college, String major) {
        return majorMapper.getMajorByCollege(college,major);
    }

    @Override
    public Integer addMajors(List<Major> major) {
        return majorMapper.addMajors(major);
    }

    @Override
    public Integer updateCollegeMajor(String college,List<Major> major) {
        majorMapper.delMajorsByCollege(college);
        return majorMapper.addMajors(major);
    }

    @Override
    public Integer delCollegeMajor(String college) {
        return majorMapper.delMajorsByCollege(college);
    }
}
